$(function() {
	setupBindings();

	function setupBindings() {
		$('#simpleForm').submit(preSubmit);
	}

	function preSubmit() {
		$(this).ajaxSubmit({
			cache : false,
			dataType : 'json',
			success : handleSuccess,
			error : handleFailure
		});

		return false;
	}

	function handleSuccess(data, statusText, xhr, $form) {
		if (data != null) {
			$("#successfailuremsg").text("Success");
		}
	}

	function handleFailure(jqXHR, textStatus, errorThrown) {
		$("#successfailuremsg").text(errorThrown);
	}
});